package com.atomscat.lottery.handler;

import com.atomscat.lottery.builder.TextBuilder;
import com.atomscat.lottery.service.ActivityInvitationService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author <a href="https://github.com/binarywang">Binary Wang</a>
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class SubscribeHandler extends AbstractHandler {
    private final ActivityInvitationService activityInvitationService;

    @Override
    public WxMpXmlOutMessage handle(WxMpXmlMessage wxMpXmlMessage, Map<String, Object> map, WxMpService wxMpService, WxSessionManager wxSessionManager) throws WxErrorException {
        log.debug("新关注用户 OPENID {} ", wxMpXmlMessage.getFromUser());
        activityInvitationService.sendKefuMessage(wxMpXmlMessage, map, wxMpService);
        return null;
    }

}
